#pragma once
#include "stdafx.h"


/*======================================================================*/
/*						 vector2 Linked List */
/*======================================================================*/

vector2link* Nullvector2(){return 0;};

int vector2link::InsertAfter(vector2link* after)
{
	if (list!=after->list) return 0;
	Unlinkvector2(this);
	vector2list* l=after->list;
	if (after==l->tail)
	{
		this->next=0;
		this->prev=after;
		after->next=this;
		l->tail=this;
	}
	else
	{
		this->prev=after;
		after->next->prev=this;
		this->next=after->next;
		after->next=this;
	};
	list->count++;
	return 1;
};

int vector2link::InsertBefore(vector2link* before)
{
	if (list!=before->list) return 0;
	Unlinkvector2(this);
	vector2list* l=before->list;
	if (before==l->head)
	{
		this->prev=0;
		this->next=before;
		before->prev=this;
		l->head=this;
	}
	else
	{
		this->next=before;
		before->prev->next=this;
		this->prev=before->prev;
		before->prev=this;
	};
	list->count++;
	return 1;
};


